package com.deere.model;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
 * 零件的加工流程
 * @author zhaohongxing
 *
 */
@Entity
@Table(name = "ITEM_WOKFLOW")
@IdClass(com.deere.model.pk.ItemWorkflowId.class)
public class ItemWorkflow extends GenericModel{
	/*
	 * 零件图号
	 */
	private String partCode; 
	/*
	 * 工序编码
	 */
	private String wpCode; 
	/*
	 * 工序序列
	 * 工序间的序列需要留有空余的值，以便向已有的工序间插入工序。
	 */
	private int sequence;
	/*
	 * 首道工序
	 */
	private String firstProcedure;
	/*
	 * 此工序所需的工时（单件）
	 */
	private float manHours;
	/*
	 * 流程中的工序集合
	 */
	private WorkingProcedure procedure;
	
	@Id
	public String getPartCode() {
		return partCode;
	}

	public void setPartCode(String partCode) {
		this.partCode = partCode;
	}
	@Id
	public String getWpCode() {
		return wpCode;
	}

	public void setWpCode(String wpCode) {
		this.wpCode = wpCode;
	}
	@Id
	//@GeneratedValue(strategy=GenerationType.AUTO)
	public int getSequence() {
		return sequence;
	}

	public void setSequence(int sequence) {
		this.sequence = sequence;
	}

	public String getFirstProcedure() {
		return firstProcedure;
	}

	public void setFirstProcedure(String firstProcedure) {
		this.firstProcedure = firstProcedure;
	}
	@OneToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="wpCode",insertable=false,updatable=false)
	public WorkingProcedure getProcedure() {
		return procedure;
	}

	public void setProcedure(WorkingProcedure procedure) {
		this.procedure = procedure;
	}

	public float getManHours() {
		return manHours;
	}

	public void setManHours(float manHours) {
		this.manHours = manHours;
	} 
	
}
